﻿using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Core.Events;
using Event.Core.Events;

namespace Core.Entity
{
    /// <summary>
    /// 代表Id为Long型的领域实体接口
    /// </summary>
    public abstract class BaseEntity : IEntity
    {
        /// <summary>
        /// 触发领域事件
        /// </summary>
        /// <typeparam name="TEvent"></typeparam>
        /// <param name="event"></param>
        public void Publish<TEvent>(TEvent @event) where TEvent : class, IEvent
        {
            EventBus.Instance.Publish(@event);
        }
        public long Id { get; set; }
    }
}
